using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestGUI
{
   
    public partial class Form1 : Form
    {
        
        List<MyPixel> lines = new List<MyPixel>();
        
        public Form1()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
        
             if (e.Button==MouseButtons.Left) 
            {

                List<MyPixel> points = new List<MyPixel>();
                for (int i=e.X-2;i<=e.X+2;i++)
                     for(int j= e.Y-2;j<=e.Y+2;j++)
                     {
                         points.Add(new MyPixel(i, j));
                     }
             this.drawIt(points);            
            }
            
            
        }

        public void drawIt(List<MyPixel> line)
        {
            Bitmap pic = (Bitmap)pictureBox1.Image;
            foreach (MyPixel p in line)
            {
                pic.SetPixel(p.x, p.y, Color.FromArgb(255, 0, 0));
                if (!lines.Contains(p))
                    lines.Add(p);
            }
            pictureBox1.Refresh();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int[,] a = new int[7, 8];
            label1.Text = a.Rank.ToString() + "   "+a.Length.ToString();
           
        }

        public class MyPixel
        {
            public int x;
            public int y;
            public int hight;
            //public int label;
            //public int dist;

            public MyPixel()
            {

            }

            public MyPixel(int x, int y)
            {
                this.x = x;
                this.y = y;
            }

            public MyPixel(int x, int y, int hight)
            {
                this.x = x;
                this.y = y;
                this.hight = hight;
            }


            public override bool Equals(Object obj)
            {
                MyPixel p = (MyPixel)obj;
                return (x == p.x && x == p.y);
            }

            public override int GetHashCode()
            {
                return x;
            }


        }
        
    }
}